<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="icon" href="favicon.ico">
    <title>Spring Boot Solr 集成</title>
</head>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<body>
<h1>数据量大同步会超时，请在后台看结果</h1>
<button onclick="readUseTimeOrder(1)">读取全部数据耗时(Sql Server)</button>
<button onclick="readUseTimeOrder(2)">读取全部数据耗时(Solr)</button>
<hr>
<button onclick="batchSyncOrder(1)">批量同步Order(SolrTemplate)</button>
<button onclick="batchSyncOrder(2)">批量同步Order(SolrClient)</button>
<hr>
<h3> Sql 的 <span style="color: red"> _ % </span>对应 Solr 的 <span style="color: red"> ? * </span></h3>
<form id="data-form">
    <table border="1">
        <tr>
            <td>收货时间</td>
            <td><input type="text" id="sDate" name="sDate" maxlength="10" value="2020-08-01">-
                <input type="text" id="eDate" name="eDate" maxlength="10" value="2020-09-30"></td>
        </tr>
        <tr>
            <td>店铺编号</td>
            <td><input type="text" id="shopIds" name="shopIds">用,分割</td>
        </tr>
        <tr>
            <td>订单号</td>
            <td><input type="text" id="oid" name="oid"></td>
        </tr>
        <tr>
            <td>配送备注</td>
            <td><input type="text" id="deliveryNote" name="deliveryNote"></td>
        </tr>
        <tr>
            <td>金额大于等于</td>
            <td><input type="text" id="amountGt" name="amountGt"></td>
        </tr>
        <tr>
            <td>金额小于等于</td>
            <td><input type="text" id="amountLt" name="amountLt"></td>
        </tr>
        <tr>
            <td colspan="2">
                <button onclick="query()" type="button">查询</button>
            </td>
        </tr>
    </table>
</form>

<hr>
<div id="syncResult"></div>
<script>

    function readUseTimeOrder(act) {
        $.post("/readUseTimeOrder", {act: act}, function (res) {
            $("#syncResult").html(JSON.stringify(res));
        }, "json");
    }

    function batchSyncOrder(act) {
        $.post("/batchSyncOrder", {act: act}, function (res) {
            $("#syncResult").html(JSON.stringify(res));
        }, "json");
    }

    function query() {
        var param = $("#data-form").serialize();
        $.post("/queryOrder", param, function (res) {
            $("#syncResult").html(JSON.stringify(res));
        }, "json");
    }

</script>
</body>
</html>